package com.hansming.bss.modules.sfc.dao;

import java.math.BigDecimal;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.hansming.bss.common.persistence.CrudDao;
import com.hansming.bss.common.persistence.annotation.MyBatisDao;
import com.hansming.bss.modules.sfc.entity.CarInfo;
import com.hansming.bss.modules.sfc.entity.Customer;
import com.hansming.bss.modules.sfc.entity.Line;
import com.hansming.bss.modules.sfc.entity.Order;
import com.hansming.bss.modules.sfc.util.PageBean;

/**
 * 订单借口哦Dao接口
 * @author Hansming
 * @version 2017-09-15
 */
@MyBatisDao
public interface OrderDao extends CrudDao<Order>{

	//得到所有订单
	public List<Order> getAllOrder(Order order);	
	
	//得到租车订单列表
	public Order getCarOrder(Order order);
	
	//根据订单信息查找线路订单
	public Order getLineOrder(Order order);
	
	//根据订单查找房车订单
	public List<Order> findCarList(Order order);
	
	//根据订单信息查找线路订单
	public List<Order> findLineList(Order order);
	
	//根据用户id得到其所有的订单     注num为显示的信息数量
	public List<Order>	findOrderListByUserid(@Param("uid")String uid,@Param("num")int num);
	
	//根据用户id查找其对应状态的订单 为了区别Order属性state ，取名为states
	public List<Order> findOrderListBycusidAndOrderStats(@Param("uid")String uid,@Param("states")String states);
	
	public List<Order> findOrderBytypeandstate(@Param("type")String type,@Param("state")String state,@Param("uid")String uid);
	
	
	//getsgin
	public Order getsgin(String orderid);
	
	//状态改变 4个
	public void changtotbd(String orderid);
	
	public void changtosuccess(String orderid);
	
	public void changtorefunding(String orderid);
	
	public void changtorefunded(String orderid);

	//根据展示状态来查询订单;
	public	List<Order>  selectOrderByShowState(@Param("uid")String uid,@Param("state")String state);
	

	//根据用户id查找其对应的订单的数量。
	public int findstateordernum(@Param("uid")String uid,@Param("states")String states);
	
	//全属性存储订单
	public void savecarorder(@Param("id")String id,@Param("num")String num,@Param("state")String state,@Param("carinfo")CarInfo carinfo ,@Param("type")String type,
			@Param("cname")String came,@Param("phone")String phone,@Param("email")String email,
			@Param("identtype")String identtype,@Param("identnum")String identnum,@Param("price")BigDecimal price,
			@Param("customer")Customer user,@Param("beginDate")String startDate,@Param("endDate")String endDate,
			@Param("begintime")Integer starttime,@Param("endtime")Integer endtime,@Param("score_costs")Integer scorecosts,@Param("cusmsg")String cusmsg);
	
//	public void saveorder(@Param("order")Order order);
	
	public void savecarorderbyorder(Order order);
	//保存线路订单
	public void savelineorder(Order order);
	
	//支付订单prepayid存储
	public void saveprepayid(@Param("prepayid")String prepayid,@Param("id")String id);
	
	//支付根据prepayid修改状态为支付完成
	public void updatestatebyprepayid(@Param("prepayid")String prepayid);
	
	public void updatetextbywxnum(@Param("wxnum")String wxnum);
	
	public Order selectorederbywxnum(@Param("wxnum")String wxnum);
	
	//根据订单id查找对应订单
	public Order selectOrderByid(@Param("order")Order order);
	
	//阿里支付根据订单id查找对应订单
	public Order alipayget(@Param("id")String id);
	
	public List<Order> getsmOrderBysmt(@Param("ordernum")String ordernum,@Param("type")String type,@Param("userid")String userid,@Param("pagebean")PageBean pagebean);
	
	public List<Order> getsmOrderBysmt2(@Param("ordernum")String ordernum,@Param("type")String type,@Param("ids")String[] ids,@Param("pagebean")PageBean pagebean);
	
	public int getsmOrdernumBysmt(@Param("ordernum")String ordernum,@Param("type")String type,@Param("userid")String userid);
	
	public int getsmOrdernumBysmt2(@Param("ordernum")String ordernum,@Param("type")String type,@Param("ids")String[] ids);
	
}
